/////////////////////////////////////////////////////////////////////////////
// Name:        commandeditortypedialog.cpp
// Purpose:     
// Author:      Julian Smart
// Modified by: 
// Created:     15/12/2008 16:32:25
// RCS-ID:      
// Copyright:   (c) Anthemion Software Limited
// Licence:     New BSD License
/////////////////////////////////////////////////////////////////////////////

#include "wx/wx.h"

////@begin includes
////@end includes

#include "commandeditor/commandeditortypedialog.h"

////@begin XPM images
////@end XPM images

bool wxCommandEditorTypeDialog::sm_useTooltips = true;

/*
 * wxCommandEditorTypeDialog type definition
 */

IMPLEMENT_DYNAMIC_CLASS( wxCommandEditorTypeDialog, wxDialog )


/*
 * wxCommandEditorTypeDialog event table definition
 */

BEGIN_EVENT_TABLE( wxCommandEditorTypeDialog, wxDialog )

////@begin wxCommandEditorTypeDialog event table entries
////@end wxCommandEditorTypeDialog event table entries

END_EVENT_TABLE()

/*
 * wxCommandEditorTypeDialog constructors
 */

wxCommandEditorTypeDialog::wxCommandEditorTypeDialog()
{
    Init();
}

wxCommandEditorTypeDialog::wxCommandEditorTypeDialog( const wxEditorCommands& commands, wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
    Init();
    Create(commands, parent, id, caption, pos, size, style);
}


/*
 * wxCommandEditorTypeDialog creator
 */

bool wxCommandEditorTypeDialog::Create( const wxEditorCommands& commands, wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
    m_commands = commands;

////@begin wxCommandEditorTypeDialog creation
    SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
    wxDialog::Create( parent, id, caption, pos, size, style );

    CreateControls();
    if (GetSizer())
    {
        GetSizer()->SetSizeHints(this);
    }
    Centre();
////@end wxCommandEditorTypeDialog creation
    return true;
}


/*
 * wxCommandEditorTypeDialog destructor
 */

wxCommandEditorTypeDialog::~wxCommandEditorTypeDialog()
{
////@begin wxCommandEditorTypeDialog destruction
////@end wxCommandEditorTypeDialog destruction
}


/*
 * Member initialisation
 */

void wxCommandEditorTypeDialog::Init()
{
////@begin wxCommandEditorTypeDialog member initialisation
    m_mediaTypeCtrl = NULL;
////@end wxCommandEditorTypeDialog member initialisation
}


/*
 * Control creation for wxCommandEditorTypeDialog
 */

void wxCommandEditorTypeDialog::CreateControls()
{    
#ifdef __WXMAC__
    SetWindowVariant(wxWINDOW_VARIANT_SMALL);
#endif

////@begin wxCommandEditorTypeDialog content construction
    wxCommandEditorTypeDialog* itemDialog1 = this;

    wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
    itemDialog1->SetSizer(itemBoxSizer2);

    wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
    itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

    wxStaticText* itemStaticText4 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Descriptive name for this file type:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);

    wxTextCtrl* itemTextCtrl5 = new wxTextCtrl( itemDialog1, ID_COMMANDEDITORTYPEDIALOG_NAME, _T(""), wxDefaultPosition, wxSize(220, -1), 0 );
    itemBoxSizer3->Add(itemTextCtrl5, 0, wxGROW|wxALL, 5);

    wxStaticText* itemStaticText6 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Media type:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer3->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);

    wxArrayString m_mediaTypeCtrlStrings;
    m_mediaTypeCtrlStrings.Add(_("Unknown"));
    m_mediaTypeCtrlStrings.Add(_("Ebook"));
    m_mediaTypeCtrlStrings.Add(_("Audio"));
    m_mediaTypeCtrlStrings.Add(_("Video"));
    m_mediaTypeCtrlStrings.Add(_("Image"));
    m_mediaTypeCtrlStrings.Add(_("Document"));
    m_mediaTypeCtrl = new wxChoice( itemDialog1, ID_COMMANDEDITORTYPEDIALOG_MEDIA_TYPE, wxDefaultPosition, wxDefaultSize, m_mediaTypeCtrlStrings, 0 );
    m_mediaTypeCtrl->SetStringSelection(_("Unknown"));
    itemBoxSizer3->Add(m_mediaTypeCtrl, 0, wxGROW|wxALL, 5);

    wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Extensions supported, separated by semicolons:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer3->Add(itemStaticText8, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);

    wxTextCtrl* itemTextCtrl9 = new wxTextCtrl( itemDialog1, ID_COMMANDEDITORTYPEDIALOG_EXTENSIONS, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer3->Add(itemTextCtrl9, 0, wxGROW|wxALL, 5);

    wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _("Extension determining the default system command for &viewing these files:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer3->Add(itemStaticText10, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);

    wxTextCtrl* itemTextCtrl11 = new wxTextCtrl( itemDialog1, ID_COMMANDEDITORTYPEDIALOG_VIEW_EXTENSION, _T(""), wxDefaultPosition, wxSize(80, -1), 0 );
    itemBoxSizer3->Add(itemTextCtrl11, 0, wxALIGN_LEFT|wxALL, 5);

    wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _("Extension determining the default system command for editing these &files:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer3->Add(itemStaticText12, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);

    wxTextCtrl* itemTextCtrl13 = new wxTextCtrl( itemDialog1, ID_COMMANDEDITORTYPEDIALOG_EDIT_EXTENSION, _T(""), wxDefaultPosition, wxSize(80, -1), 0 );
    itemBoxSizer3->Add(itemTextCtrl13, 0, wxALIGN_LEFT|wxALL, 5);

    wxStdDialogButtonSizer* itemStdDialogButtonSizer14 = new wxStdDialogButtonSizer;

    itemBoxSizer3->Add(itemStdDialogButtonSizer14, 0, wxGROW|wxALL, 5);
    wxButton* itemButton15 = new wxButton( itemDialog1, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
    itemButton15->SetDefault();
    itemStdDialogButtonSizer14->AddButton(itemButton15);

    wxButton* itemButton16 = new wxButton( itemDialog1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
    itemStdDialogButtonSizer14->AddButton(itemButton16);

    itemStdDialogButtonSizer14->Realize();

    // Set validators
    itemTextCtrl5->SetValidator( wxGenericValidator(& m_commands.m_fileTypeName) );
    m_mediaTypeCtrl->SetValidator( wxGenericValidator(& m_commands.m_mediaType) );
    itemTextCtrl9->SetValidator( wxGenericValidator(& m_commands.m_fileTypeExtensions) );
    itemTextCtrl11->SetValidator( wxGenericValidator(& m_commands.m_fileTypeExtensionForDefaultViewing) );
    itemTextCtrl13->SetValidator( wxGenericValidator(& m_commands.m_fileTypeExtensionForDefaultEditing) );
////@end wxCommandEditorTypeDialog content construction
}


/*
 * Should we show tooltips?
 */

bool wxCommandEditorTypeDialog::ShowToolTips()
{
    return sm_useTooltips;
}

/*
 * Get bitmap resources
 */

wxBitmap wxCommandEditorTypeDialog::GetBitmapResource( const wxString& name )
{
    // Bitmap retrieval
////@begin wxCommandEditorTypeDialog bitmap retrieval
    wxUnusedVar(name);
    return wxNullBitmap;
////@end wxCommandEditorTypeDialog bitmap retrieval
}

/*
 * Get icon resources
 */

wxIcon wxCommandEditorTypeDialog::GetIconResource( const wxString& name )
{
    // Icon retrieval
////@begin wxCommandEditorTypeDialog icon retrieval
    wxUnusedVar(name);
    return wxNullIcon;
////@end wxCommandEditorTypeDialog icon retrieval
}
